﻿using System;


public abstract class Animal
{
    
    public abstract void Voice();
}


public class Cat : Animal
{
   
    public override void Voice()
    {
        Console.WriteLine("猫：喵喵叫");
    }
}


public class Pig : Animal
{

    public override void Voice()
    {
        Console.WriteLine("猪：哼哼叫");
    }
}


public class Dog : Animal
{
 
    public override void Voice()
    {
        Console.WriteLine("狗：汪汪叫");
    }
}


public class Store
{

    public Animal GetInstance(string animalType)
    {
        // 将输入转换为小写，使判断不区分大小写
        string type = animalType.ToLower();

        switch (type)
        {
            case "dog":
                return new Dog();
            case "pig":
                return new Pig();
            default:
                return new Cat();
        }
    }
}


class Program
{
    static void Main(string[] args)
    {
        // 创建宠物店实例
        Store petStore = new Store();

        // 测试获取不同动物并调用其叫声方法
        Animal dog = petStore.GetInstance("dog");
        dog.Voice();

        Animal pig = petStore.GetInstance("pig");
        pig.Voice();

        Animal cat1 = petStore.GetInstance("cat");
        cat1.Voice();

        Animal cat2 = petStore.GetInstance("other");
        cat2.Voice();

        // 测试题目中要求的场景
        Console.WriteLine("\n测试特定场景：");
        Animal animal = petStore.GetInstance("dog");
        animal.Voice();

        animal = petStore.GetInstance("pig");
        animal.Voice();

        animal = petStore.GetInstance("unknown");
        animal.Voice();
    }
}
